import {
  createRouter,
  createWebHashHistory,
  createWebHistory,
} from "vue-router";

import homeChildren from "./menu-router/index.js"

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/",
      redirect: "/login",
    },
    {
      path: "/login",
      name: "login",
      component: () => import("@/views/login/index.vue"),
    },
    {
      path: "/home",
      component: () => import("@/views/home/index.vue"), // 懒加载
      children: homeChildren,
      meta: {
        requireAuth: true, // 验证登录
      },
    },
    {
      path: "/:catchAll(.*)'",
      name: "404",
      component: () => import("@/components/404/index.vue"), // 懒加载
    },
  ],
});

export default router;
